class Solution
{
public:
    int distanceBetweenBusStops(vector<int> &distance, int start, int destination)
    {
        int n = distance.size();
        int d1 = 0;
        int d2 = 0;
        for (int i = start; i != destination; i = (i + 1) % n)
        {
            d1 += distance[i];
        }
        for (int i = destination; i != start; i = (i + 1) % n)
        {
            d2 += distance[i];
        }
        return min(d1, d2);
    }
};